package cn.tedu.oop;
/*本类用于面向对象的巩固练习*/
public class TestCar {
    //入口函数
    public static void main(String[] args) {
        Car c=new Car();
        c.setBrand("Tesla");
        c.setColor("Blue");
        c.setPrice(1.00);
        c.setLength(2.0);
        c.start();
        System.out.println("c.getBrand() = " + c.getBrand());
        System.out.println("c.getColor() = " + c.getColor());
        System.out.println("c.getPrice() = " + c.getPrice());
        System.out.println("c.getLength() = " + c.getLength());
        
    }
}
//1.抽象汽车这一类事物的属性和行为，封装成一个组件
class Car{
    private String brand;
    private String color;
    private double price;
    private double length;
    
    public void start(){
        System.out.println("Start~~~~~");
        stop();
    }

    private void stop() {
        System.out.println("Stop~~~~~");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }
}